package com.slipper.groovy.util;

import com.slipper.groovy.service.GroovyService;

import java.io.Writer;
import java.util.Map;

public class ScriptUtil {
    private final Writer writer;

    public ScriptUtil(Writer writer) {
        this.writer = writer;
    }

    public Object run(String id) {
        return GroovyService.runById(id, this.writer);
    }

    public Object run(String id, Map<String, Object> data) {
        return GroovyService.runById(id, data, this.writer);
    }
}
